package com.rongcheng.frc.newstyledemo.engine;

import android.app.Activity;
import android.app.Application;

import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.rongcheng.frc.androidlib.cache.CacheManager;

public class YoungHeartApplication extends Application {


    public static YoungHeartApplication getInstance() {
        return YoungHeartHolder.instance;
    }

    private static class YoungHeartHolder {
        private final static YoungHeartApplication instance = new YoungHeartApplication();
    }

    @Override
    public void onCreate() {
        super.onCreate();

        CacheManager.getInstance().initCacheDir();

        ImageLoaderConfiguration config =
                new ImageLoaderConfiguration.Builder(
                        getApplicationContext())
                        .threadPriority(Thread.NORM_PRIORITY - 2)
                        .memoryCacheExtraOptions(480, 480)
                        .memoryCacheSize(2 * 1024 * 1024)
                        .denyCacheImageMultipleSizesInMemory()
                        .discCacheFileNameGenerator(new Md5FileNameGenerator())
                        .tasksProcessingOrder(QueueProcessingType.LIFO)
                        .memoryCache(new WeakMemoryCache()).build();
        ImageLoader.getInstance().init(config);

    }


}
